#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main()
{
	int money = 0;
	scanf("%d", &money);
	int wa = money;
	while(1)
	{
		if (wa % 2 != 0)
		{
           wa = wa + money - 1;
		   break;
		}
		else
		{
			money = money / 2;
			wa += money;
		}
	}
	printf("%d\n", wa);
	return 0;
}
